package nc.bs.gsp.hf051610;

import nc.bs.medpub.pub.MedQueryDMO;
import nc.vo.gsp.hf051610.ZlXxfkVO;
import nc.vo.gsp.pub.GspConst;
import nc.vo.pub.BusinessException;
import nc.vo.pub.CircularlyAccessibleValueObject;

public class RefQueryDMO extends MedQueryDMO {

	@Override
	protected String getBillType() {
		return GspConst.ZLXXFK;
	}

	@Override
	protected Class<?> getHeadVOClass() {
		return ZlXxfkVO.class;
	}
	
	@Override
	protected Class<?> getBodyVOClass() {
		return ZlXxfkVO.class;
	}

	public CircularlyAccessibleValueObject[] queryAllHeadData(String whereString)
			throws BusinessException {
		CircularlyAccessibleValueObject[] vos = null;
		if (whereString != null && whereString.length() > 0) {
			whereString += " and (isclose is null or isclose = 'N') and vbillstatus = 1 ";
		} else {
			whereString = " (isclose is null or isclose = 'N')  and vbillstatus = 1 ";
		}
		vos = queryAllHeadData(getHeadVOClass(), whereString);

		return vos;
	}

	public CircularlyAccessibleValueObject[] queryAllBodyData(String key,
			String whereString) throws BusinessException {
		CircularlyAccessibleValueObject[] retVos = null;
		if (whereString != null && whereString.length() > 0) {
			whereString += " and (isclose is null or isclose = 'N')";
		} else {
			whereString = " (isclose is null or isclose = 'N')";
		}
		retVos = queryAllBodyData(getBillType(), getBodyVOClass(), key,
				whereString);
		return retVos;
	}
	
}
